package com.nbsaas.boot.user.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 签到配置实体类
 * 
 * @author 系统生成
 */
@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "签到配置", model = "签到配置")
@Entity
@Table(name = "bs_sign_in_config")
@Comment("签到配置表")
public class SignInConfig extends AbstractEntity {

    @Comment("配置名称")
    @SearchItem(name = "configName", key = "configName", label = "配置名称")
    @FormField(title = "配置名称", sortNum = "1", grid = true, required = true)
    @Column(name = "config_name", length = 100, nullable = false)
    private String configName;

    @Comment("配置编码")
    @SearchItem(name = "configCode", key = "configCode", label = "配置编码")
    @FormField(title = "配置编码", sortNum = "2", grid = true, required = true)
    @Column(name = "config_code", length = 50, nullable = false, unique = true)
    private String configCode;

    @Comment("配置类型")
    @FormField(title = "配置类型", sortNum = "3", grid = true, type = InputType.select)
    @Column(name = "config_type", length = 50)
    private String configType; // DAILY-每日签到, WEEKLY-每周签到, MONTHLY-每月签到, SPECIAL-特殊签到

    @Comment("基础积分奖励")
    @FormField(title = "基础积分奖励", sortNum = "4", grid = true, type = InputType.el_input_number)
    @Column(name = "base_points", precision = 10, scale = 0)
    private Integer basePoints;

    @Comment("基础金额奖励")
    @FormField(title = "基础金额奖励", sortNum = "5", grid = true, type = InputType.el_input_number)
    @Column(name = "base_amount", precision = 10, scale = 2)
    private BigDecimal baseAmount;

    @Comment("连续签到额外积分")
    @FormField(title = "连续签到额外积分", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(name = "continuous_extra_points", precision = 10, scale = 0)
    private Integer continuousExtraPoints;

    @Comment("连续签到额外金额")
    @FormField(title = "连续签到额外金额", sortNum = "7", grid = true, type = InputType.el_input_number)
    @Column(name = "continuous_extra_amount", precision = 10, scale = 2)
    private BigDecimal continuousExtraAmount;

    @Comment("最大连续天数")
    @FormField(title = "最大连续天数", sortNum = "8", grid = true, type = InputType.el_input_number)
    @Column(name = "max_continuous_days")
    private Integer maxContinuousDays;

    @Comment("签到时间范围开始")
    @FormField(title = "签到时间范围开始", sortNum = "9", grid = true)
    @Column(name = "sign_time_start", length = 10)
    private String signTimeStart; // 格式：HH:mm

    @Comment("签到时间范围结束")
    @FormField(title = "签到时间范围结束", sortNum = "10", grid = true)
    @Column(name = "sign_time_end", length = 10)
    private String signTimeEnd; // 格式：HH:mm

    @Comment("是否启用")
    @FormField(title = "是否启用", sortNum = "11", grid = true, type = InputType.select)
    @Column(name = "is_enabled")
    private Boolean isEnabled;

    @Comment("生效开始日期")
    @FormField(title = "生效开始日期", sortNum = "12", type = InputType.date, grid = true)
    @Column(name = "effective_start_date")
    private Date effectiveStartDate;

    @Comment("生效结束日期")
    @FormField(title = "生效结束日期", sortNum = "13", type = InputType.date, grid = true)
    @Column(name = "effective_end_date")
    private Date effectiveEndDate;

    @Comment("配置描述")
    @FormField(title = "配置描述", sortNum = "14", type = InputType.textarea)
    @Column(name = "config_description", length = 1000)
    private String configDescription;

    @Comment("配置规则")
    @FormField(title = "配置规则", sortNum = "15", type = InputType.textarea)
    @Column(name = "config_rules", columnDefinition = "TEXT")
    private String configRules; // JSON格式存储详细规则

    @Comment("排序")
    @FormField(title = "排序", sortNum = "16", grid = true, type = InputType.el_input_number, sort = true)
    @Column(name = "sort_order")
    private Integer sortOrder;
} 